import axios from 'axios';
import * as constants from './constants';
import {
	fromJS
} from 'immutable';

export const getDetail = (id) => {
	return (dispatch) => {
		axios.get('/api/detail.json?id=' + id).then((res) => {
			const data = res.data.data;
			dispatch(changeDetail(data));
		})
	}
}

const changeDetail = (data) => ({
	type: constants.CHANGE_DETAIL,
	data: fromJS(data)
})